Skip to content

crypto: the test support includes <mm_malloc.h> before its replaced C allocation functions - #21

Merged
pinhopro merged 1 commit into
mainfrom
main-ci-fix
Dec 3, 2026
Merged

pinhopro merged 1 commit into
mainfrom
main-ci-fix

Conversation

@pinhopro

@pinhopro pinhopro commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Every test that includes test/support/counting.hpp and then a header that includes the x86 intrinsics failed to compile with Clang on x86_64 Linux:

mm_malloc.h:25:16: error: 'posix_memalign' is missing exception specification 'noexcept'
counting.hpp: note: previous declaration is here

Clang's <mm_malloc.h> (from <emmintrin.h>, which Boost.URL and Boost.JSON include on x86) redeclares posix_memalign without an exception specification. Clang accepts that only when the declaration before it is a system header's (glibc's, __THROW); after the test support's noexcept replacement it is an error. GCC's <mm_malloc.h> declares it throw (), and arm64 never includes it, so only the Clang lanes on x86_64 Linux saw it: on webcpp's main (run 46916884991) the Clang 18 and Clang 22 lanes failed to compile codecs' percent tests and crypto's formats tests, and the CI lint's clang-tidy (wasi-sdk's Clang 23, with the host target) failed shards 1, 4, 6, 7, 9 and 10. The macOS and arm64 Linux lints could not see it.

The fix: the glibc branch of the test support includes <mm_malloc.h> (when the compiler has it) before the replacements, so its redeclaration follows glibc's.

Reproduced and verified on x86_64 Linux (Docker, clang++-18): codecs' percent_test.cpp and allocation_percent_test.cpp failed with that error before and compile after; the Linux lint (amd64) on the affected units.

The same change is made to the copies in secure, hash, crypto and codecs; in this library it is latent or failing as follows: failing (formats_ed25519_sodium, formats_x25519_sodium, p256_formats_bearssl, secp256k1_formats).

🤖 Generated with Claude Code

… allocation functions

Clang's <mm_malloc.h>, which the x86 intrinsic headers include (Boost.URL's and
Boost.JSON's <emmintrin.h>), redeclares posix_memalign without an exception
specification. Clang accepts that only after a system header's declaration; after
the test support's noexcept replacement it is an error, so every test that
includes counting.hpp and then such a Boost header failed to compile with Clang on
x86_64 Linux (the Clang 18 and Clang 22 lanes and the CI lint).
pinhopro pushed a commit to webcpporg/webcpp that referenced this pull request Dec 3, 2026
…ix branches

webcpporg/codecs#2, webcpporg/crypto#21, webcpporg/hash#18 and webcpporg/secure#2: the test
support includes <mm_malloc.h> before its replaced C allocation functions (Clang on x86_64
Linux), and codecs' dudect base58 cases prepare by the constant-time conversion. Moved to
their merges once they are merged.
@pinhopro
pinhopro merged commit 7123aee into main Dec 3, 2026
34 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant